/* 页面交互效果 */

(function(win, $) {
    $('#slider').Xslider({
        affect: 'scrollx', //scrollx 水平轮播 scrolly 垂直轮播
        speed: 1000,
        space: 3000,
        conbox: '.wb-slider-conbox',
        ctag: '.wb-slider-ctag',
        switcher: '.wb-slider-switcher',
        stag: '.wb-slider-stag',
        current: 'cur',
        trigger: 'click',
        boxWidth: '588',
        boxHeight: '300'
    });

    $(".tab-view").each(function(index, el) {
        new TabView({
            dom: el,
            activeCls: 'current',
            triggerEvent: 'mouseover'
        });
    });

    var wwidth = $(window).width();
    if (wwidth > 1380) {
        var wheight = $(window).height();
        var allheight = 76 + 60 + 40 + 300 + 140 + 40;
        var xheight = wheight - allheight;
        var pheight = (xheight - 220) / 2 + 20;
        if (xheight > 220) {
            $('.ewb-option-mod img').css({
                height: '220px'
            });
            $('.ewb-option-mod').css({
                height: '220px'
            });

            $('.ewb-option').css({
                marginTop: pheight
            });

            $('.ewb-main').css({
                paddingBottom: pheight
            });
        } else if(xheight >100) {
            $('.ewb-option-mod img').css({
                height: xheight
            });
            $('.ewb-option-mod').css({
                height: xheight
            });
        }
    }
	//政策数量
	$.ajax({
		url: Util.AjaxRUrl + 'getPolicyNum?param={}',
		type: "post",
		dataType: "json",
		success: function(msg) {
			// console.log(msg);
			var policyNum = msg.PolicyNum.policyNum;
			$("#zcsl").html(policyNum);
		},
		error: function(XMLHttpRequest, txtStatus, errorThrown) {
			//console.log(XMLHttpRequest);
		}
	});
}(this, jQuery));

(function(win, $) {
    var event = function event() {
        var eventInterval = [
            0,
            0,
            0,
            0
        ];
        var isHover = [
            0,
            0,
            0,
            0
        ];
        var oL = $(".ewb-func-item");
        oL.hover(function () {
            $(this).addClass('event-in');
            var _this = $(this);
            var index = $(this).index();
            isHover[index] = 1;
            eventInterval[index] = setInterval(function () {
                if (isHover[index]) {
                    _this.addClass('event-in');
                }
            }, 3600);
        }, function () {
            var index1 = $(this).index();
            isHover[index1] = 0;
        });
        oL.on('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function () {
            var index2 = $(this).index();
            if (isHover[index2] === 0) {
                $(this).removeClass('event-in');
                clearInterval(eventInterval[index2]);
            } else {
                $(this).removeClass('event-in');
            }
        });
    };

    event();
}(this, jQuery));